"""
 encoding    : utf-8
 @File       : loginpage.py
 @Author     : jiahong
 @Version    :
 @Description:
 @Date       : 2024/07/10
"""
from selenium.webdriver import *

class LoginPage:
    def __init__(self, browser):
        self.browser = browser()
        self.browser.implicitly_wait(10)
        self.browser.get('http://192.168.1.155/cloud/#/open/login')

    def input_username(self, username):
        self.browser.find_element(by='css selector', value='[placeholder="用户名"]').send_keys(username)

    def input_password(self, password):
        self.browser.find_element(by='css selector', value='[placeholder="密码"]').send_keys(password)

    def input_verification_code(self):
        self.browser.find_element(by='css selector', value='[placeholder="验证码"]').send_keys(8888)

    def click_login_button(self):
        self.browser.find_element(by='css selector', value='.ant-btn').click()

if __name__ == '__main__':
    login_page = LoginPage(Firefox)
    login_page.input_username('admin')
    login_page.input_password('123456')
    login_page.input_verification_code()
    login_page.click_login_button()

